﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Core.cs" company="GT">
//   Gunther Taborga
// </copyright>
// <summary>
//   Defines the BatchId3Module type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace BatchID3.Ioc
{
    using System.ComponentModel;
    using System.Linq;

    using BatchID3.FileSystem;
    using BatchID3.FileSystem.Directory;
    using BatchID3.FileSystem.File;
    using BatchID3.FileSystem.Path;
    using BatchID3.Lists;
    using BatchID3.Mp3;

    using Ninject.Modules;

    public class Core : NinjectModule
    {
        public override void Load()
        {
            // List Binding
            this.Bind<IBindingList>().To<SortableBindingList<IMp3Entity>>()
                .WithConstructorArgument("enumeration", Enumerable.Empty<IMp3Entity>()); // ensures list is initialized empty
            
            // File System
            this.Bind<IFileManager>().To<FileManager>();
            this.Bind<IDirectoryManager>().To<DirectoryManager>();
            this.Bind<IPathManager>().To<PathManager>();
            this.Bind<IFileSystemManager>().To<FileSystemManager>();
            
            // Mp3 Entity
            this.Bind<IMp3FileSystemManager>().To<Mp3FileSystemManager>();
            this.Bind<IMp3EntityFactory>().To<Mp3EntityFactory>().InSingletonScope();
            this.Bind<IMp3PreviewFactory>().To<Mp3PreviewFactory>();
            this.Bind<IMp3Entity>().To<Mp3Entity>();
        }
    }
}